package com.m3958.logcollector.datacommons.util;

import java.util.List;
import java.util.Map;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

public class M3958ValidationErrors {
    
    private final Map<String, List<String>> errors;
    
    public M3958ValidationErrors(String fieldName, String message) {
        this.errors =  Maps.newHashMap();
        this.putOne(fieldName, message);
    }
    
    public M3958ValidationErrors() {
        this.errors  = Maps.newHashMap();
    }

    public void putOne(String fieldName, String message) {
        if (errors.containsKey(fieldName)) {
            errors.get(fieldName).add(message);
        } else {
            errors.put(fieldName, Lists.newArrayList(message));
        }
    }

    public Map<String, List<String>> getErrors() {
        return errors;
    }
}
